#ifndef PARSESDT_H_
#define PARSESDT_H_

#define SDT_DESCRIPTOR_MAX 1024
#define SDT_EVENT_MAX 128
#define SDT_PROGRAM_NAME_LENGTH 512

typedef struct TS_SDT_SERVICE
{
    unsigned service_id :16;
    unsigned reserved_future_use :6;
    unsigned EIT_schedule_flag :1;
    unsigned EIT_present_following_flag :1; 
    unsigned running_status :3;
    unsigned free_CA_mode :1;
    unsigned descriptors_loop_length :12;
	unsigned char descriptor[SDT_DESCRIPTOR_MAX];
} TS_SDT_SERVICE;

typedef struct TS_SDT
{
    unsigned table_id :8;
    unsigned section_syntax_indicator :1;
    unsigned reserved_future_use_1 :1;
    unsigned reserved_1 :2;
    unsigned section_length :12;
    unsigned transport_stream_id :16;
    unsigned reserved_2 :2;
    unsigned version_number :5;
    unsigned current_next_indicator :1;
    unsigned section_number :8;
    unsigned last_section_number :8;
    unsigned original_network_id :16;
    unsigned reserved_future_use_2 :8;

	TS_SDT_SERVICE SDT_Service[SDT_EVENT_MAX];

    unsigned CRC_32 :32;

    struct TS_SDT *next; 
	struct TS_SDT *Previous;
} TS_SDT;

TS_SDT *TS_PackageSdtPoint;
TS_SDT *SdtPoint;

#endif